import axios from 'axios'
export const getReply = async (commentid)=>{
  return axios({
    url:'http://localhost:3000/reply',
    params:{commentid}
  })
}
export const getComment = async (articleid)=>{
  let res = await axios({
    url:'http://localhost:3000/comment',
    params:{articleid}
  })
  for(let k of res.data){
  let res2 = await getReply(k.id)
  k.reply=res2.data
  }
  return res
}
export const postComment = async (data)=>{
  return axios({
    url:'http://localhost:3000/comment',
    method:'POST',
    data
  })
}
export const postReply = async (data)=>{
  return axios({
    url:'http://localhost:3000/reply',
    method:'POST',
    data
  })
}